import Cookies from 'js-cookie'
import Cache from '@/plugins/cache'

export const TokenKey = 'HKTOKEN'

export const FullTokenKey = 'fullToken'

const cache = Cache.local
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function getFullToken() {
  return cache.getJSON(FullTokenKey)
}

export function setFullToken(token) {
  return cache.setJSON(FullTokenKey, token)
}

export function removeToken() {
  cache.remove(FullTokenKey)
  Cookies.remove(TokenKey)
}

export function setSessionId(sid) {
  return cache.set('sid', sid)
}

export function getSessionId() {
  return cache.get('sid')
}

export function removeSession() {
  Cookies.remove('sid')
}

